package io.github.talelin.latticy.controller.v1;

import io.github.talelin.core.annotation.AdminRequired;
import io.github.talelin.core.annotation.PermissionMeta;
import io.github.talelin.core.annotation.PermissionModule;
import io.github.talelin.latticy.model.UserDO;
import io.github.talelin.latticy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @authoer:wulongbo
 * @createDate:2022/5/12
 * @description:
 */

@RestController
@RequestMapping("/v1/user")
@PermissionModule(value = "用户组")
@Validated
public class UserLevelController {

    @Autowired
    private UserService userService;

    @AdminRequired
    @GetMapping("/userGroup/users")
    @PermissionMeta(value = "获取用户分组下的所有用户数据", mount = false)
    public List<UserDO> getGroupUsers() {
        return userService.getUserByUserGroup();
    }
}
